/// @tags:
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

int const N = 1e3 + 5, mod = 1e9 + 7, K = 50;

int n;
int f[N][N][K], fac[N], inv[N];

inline int qpow(LL base, int exp) {
  LL res = 1;
  while (exp) {
    if (exp & 1) res = res * base % mod;
    exp >>= 1;
    base = base * base % mod;
  }
  return res;
}

inline LL C(int n, int m) { return (LL)fac[n] * inv[m] % mod * inv[n - m] % mod; }

inline LL A(int n, int m) { return (LL)fac[n] * inv[n - m] % mod; }

inline int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, m, k;
    cin >> n >> m >> k;
    f[0][n][0] = 1;
    for (int i = 1; i <= m; ++i) {
      for (int h = 1; h <= k; ++h)
        f[i][1][h] = ((LL)f[i - 1][n][h] * h % mod + f[i - 1][n][h - 1] % mod) % mod;
      for (int j = 2; j <= n; ++j) {
        for (int h = 1; h <= k; ++h)
          f[i][j][h] = ((LL)f[i][j - 1][h] * h % mod + f[i][j - 1][h - 1] % mod) % mod;
      }
    }
    fac[0] = 1;
    for (int i = 1; i <= k; ++i) { fac[i] = (LL)fac[i - 1] * i % mod; }
    inv[k] = qpow(fac[k], mod - 2);
    for (int i = k - 1; i >= 0; --i) inv[i] = (LL)inv[i + 1] * (i + 1) % mod;
    int ans = 0;
    for (int i = 1; i < m; ++i) {
      for (int j = 1; j <= k; ++j) {
        ans += A(k, j) * A(k, j) % mod * f[i][n][j] % mod * f[m - i][n][j] % mod;
        if (ans >= mod) ans -= mod;
      }
    }
    /* for (int j = 1; j <= k; ++j) {
      ans += (LL)f[1][n][j] % mod * f[1][n][j] % mod;
      if (ans >= mod) ans -= mod;
    }
     */// ans = (LL)ans * fac[k] % mod;
    cout << ans << '\n';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("color.in", "r", stdin);
  freopen("color.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
